class Teacher:
    name = "龙仔"
    age = 18
    sex = "男"
    # def __init__(self,name,age,sex): # 因为我没加初始化构造方法
    #    self.name = name
    #    self.age = age
    #    self.sex = sex
    def course(self):
        print(self)
        print("course")
        return 222

if __name__ == '__main__':
    # 通过Teacher类创建的t1对象
    t1 = Teacher()
    # 通过Teacher类创建的t2对象
    t2 = Teacher()
    # 通过Teacher类创建的t3对象
    t3 = Teacher()
    # print(t1.__dict__) # 查看对象的所有属性:{} 啥也没有
    """print(t1.name) # 如果对象本身是没有name属性。会去找类属性
    print(t2.name)
    print(t3.name)"""

    # 对象的方法
    """print(t1.course())
    print(t2.course())
    print(t3.course())"""

    # 添加类对象独有的属性
    print(t1.__dict__) # {}
    t1.name = "小龙"  # 给他加了一个属性后
    print(t1.name)
    print(t1.__dict__) #  {'name': '小龙'}

    # 对象完全独立，一个对象的操作不会对另外一个对象影响到
    print(t2.name)
    print(t2.__dict__) # {}


"""
请写一个桌子类，定义它的属性
"""
"""class Desk:
    def __init__(self,width,height,length):
        self.width = width
        self.height = height
        self.length = length"""





